<template>
  <BasicDrawer v-bind="$attrs" @register="registerDrawer" destroyOnClose title="出行时间段设置" :width="drawerWith">
    <TourTimeIndex ref="tourTimeIndex"></TourTimeIndex>
  </BasicDrawer>
</template>
<script lang="ts" setup>
import TourTimeIndex from '../../tourTime/index.vue';
import { BasicDrawer, useDrawerInner } from '@apps/antd-admin/src/components/drawer';
import { getCurrentInstance, ref, unref } from 'vue';
import { useAppInject } from '@apps/antd-admin/src/hooks/web/use-app-inject';

const { getIsMobile } = useAppInject();
const drawerWith = ref('60%');
if (unref(getIsMobile)) {
  drawerWith.value = '80%';
}
const ctx: any = getCurrentInstance();
// 声明Emits
const emit = defineEmits(['register']);

const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async data => {
  let record = data.record;
  console.info('data', record.tourRouteId);
  ctx.refs['tourTimeIndex'].setSearchInfoProps(record.tourRouteId);
});
</script>
